package com.scientific.research.gobang;

import com.scientific.research.gobang.service.RocketMqService;
import com.scientific.research.gobang.service.codegame.impl.RunCodeServiceImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

import javax.annotation.Resource;

@SpringBootApplication//SpringBoot启动类注解
@EnableDiscoveryClient//Nacos服务注册中心注解
@EnableFeignClients//开启Fegin
public class CodeGameApplication {

    //rocketMqService是消息消费者，将其和启动类绑定
    private static RocketMqService rocketMqService;

    //将rocketMqService自动注入到静态变量中
    @Resource
    void setter(RocketMqService rocketMqService) {
        CodeGameApplication.rocketMqService = rocketMqService;
    }

    public static void main(String[] args) {
        SpringApplication.run(CodeGameApplication.class, args);

        //运行消息消费者
        rocketMqService.dealMessage();
        //服务器启动创建目录
        RunCodeServiceImpl.runCodeServiceInit();
    }
}

